From dcaf76320f2187b93b3a6fb91c52c5862c729bb9 Mon Sep 17 00:00:00 2001 From: robertl Date: Thu, 12 Jan 2006 19:59:58 +0000 Subject: [PATCH] Add unicsv format to for xsv where first list describes subsequent data. --- gpsbabel/Makefile | 3 +- gpsbabel/ignrando.c | 3 +- gpsbabel/readme.xml | 28 ++++++++++++++++++ gpsbabel/reference/unicsv.gpx | 55 +++++++++++++++++++++++++++++++++++ gpsbabel/testo | 8 +++++ gpsbabel/vecs.c | 7 +++++ gpsbabel/yahoo.c | 1 - 7 files changed, 101 insertions(+), 4 deletions(-) create mode 100644 gpsbabel/reference/unicsv.gpx diff --git a/gpsbabel/Makefile b/gpsbabel/Makefile index 2adebd792..e45d60765 100644 --- a/gpsbabel/Makefile +++ b/gpsbabel/Makefile @@ -45,7 +45,7 @@ FMTS=magproto.o gpx.o geo.o mapsend.o mapsource.o garmin_tables.o \ vcf.o overlay.o kml.o google.o lowranceusr.o an1.o tomtom.o \ tef_xml.o maggeo.o pathaway.o vitosmt.o gdb.o bcr.o coto.o \ ignrando.o stmwpp.o msroute.o cst.o nmn4.o mag_pdb.o compegps.o \ - yahoo.o + yahoo.o unicsv.o FILTERS=position.o duplicate.o arcdist.o polygon.o smplrout.o \ reverse_route.o sort.o stackfilter.o trackfilter.o discard.o \ @@ -305,6 +305,7 @@ tpg.o: tpg.c defs.h queue.h gbtypes.h jeeps/gpsmath.h jeeps/gps.h \ jeeps/gpsmem.h jeeps/gpsrqst.h jeeps/gpsinput.h jeeps/gpsproj.h \ jeeps/gpsnmeafmt.h jeeps/gpsnmeaget.h trackfilter.o: trackfilter.c defs.h queue.h gbtypes.h strptime.h +unicsv.o: unicsv.c defs.h queue.h gbtypes.h csv_util.h util.o: util.c defs.h queue.h gbtypes.h util_crc.o: util_crc.c uuid.o: uuid.c uuid.h diff --git a/gpsbabel/ignrando.c b/gpsbabel/ignrando.c index 5e0dc2041..0325e3a4b 100644 --- a/gpsbabel/ignrando.c +++ b/gpsbabel/ignrando.c @@ -29,12 +29,11 @@ #if !NO_EXPAT #include -static XML_Parser psr; #endif #define MYNAME "IGNRando" -static FILE *fin, *fout; +static FILE *fout; static route_head *track; static waypoint *wpt; diff --git a/gpsbabel/readme.xml b/gpsbabel/readme.xml index 4e64799af..6e6a4c836 100644 --- a/gpsbabel/readme.xml +++ b/gpsbabel/readme.xml @@ -1530,6 +1530,34 @@ continental U.S. Points in Hawaii should use "Old Hawaiian_mean" Contributed by Alex Mottram. +
+ + Universal csv with field structure in first line. + + unicsv + + Unicsv examines the first line of a file to determine the field + order and field separator in that file. It is thus read-only format. + + + If the first line contains any tabs, the data lines are assumed + to be tab separated. Otherwise the fields are assumed to be + separated by commas. + + + The list of keywords include "lat", "lon", "desc", "name", + "notes", "alt", and "url". Fuller spellings (i.e. "longitude") may + be used. + + + A typical file may be: + + Name, Latitude, Longitude, Description + GCEBB,35.972033,-87.134700,Mountain Bike Heaven by susy1313 + GC1A37,36.090683,-86.679550,The Troll by a182pilot & Family + + +
vCard format for Apple iPod etc. diff --git a/gpsbabel/reference/unicsv.gpx b/gpsbabel/reference/unicsv.gpx new file mode 100644 index 000000000..b52cbe77e --- /dev/null +++ b/gpsbabel/reference/unicsv.gpx @@ -0,0 +1,55 @@ + + + + + + "GCEBB" + "Mountain Bike Heaven by susy1313" + "Mountain Bike Heaven by susy1313" + + + "GC1A37" + "The Troll by a182pilot & Family" + "The Troll by a182pilot & Family" + + + "GC1C2B" + "Dive Bomber by JoGPS & family" + "Dive Bomber by JoGPS & family" + + + "GC25A9" + "FOSTER by JoGPS & Family" + "FOSTER by JoGPS & Family" + + + "GC2723" + "Logan Lighthouse by JoGps & Family" + "Logan Lighthouse by JoGps & Family" + + + "GC2B71" + "Ganier Cache by Susy1313" + "Ganier Cache by Susy1313" + + + "GC309F" + "Shy's Hill by FireFighterEng33" + "Shy's Hill by FireFighterEng33" + + + "GC317A" + "GittyUp by JoGPS / Warner Parks" + "GittyUp by JoGPS / Warner Parks" + + + "GC317D" + "Inlighting by JoGPS / Warner Parks" + "Inlighting by JoGPS / Warner Parks" + + diff --git a/gpsbabel/testo b/gpsbabel/testo index 8206d0ae6..64fee0356 100755 --- a/gpsbabel/testo +++ b/gpsbabel/testo @@ -947,4 +947,12 @@ ${PNAME} -i gpx -f ${TMPDIR}/alltypes.gpx -x nuketypes,waypoints,tracks -o gpx - ${PNAME} -i gpx -f ${TMPDIR}/wpts.gpx -f ${TMPDIR}/trks.gpx -f ${TMPDIR}/rtes.gpx -o gpx -F ${TMPDIR}/merged.gpx compare ${TMPDIR}/alltypes.gpx ${TMPDIR}/merged.gpx +# +# Universal CSV - unicsv +# +echo "lat,lon,descr,name,notes,unk,unk" > ${TMPDIR}/unicsv.txt +cat reference/mxf.mxf >> ${TMPDIR}/unicsv.txt +${PNAME} -i unicsv -f ${TMPDIR}/unicsv.txt -o gpx -F ${TMPDIR}/unicsv.gpx +compare ${TMPDIR}/unicsv.gpx reference/unicsv.gpx + exit 0 diff --git a/gpsbabel/vecs.c b/gpsbabel/vecs.c index 322f2de82..d53fcda5c 100644 --- a/gpsbabel/vecs.c +++ b/gpsbabel/vecs.c @@ -95,6 +95,7 @@ extern ff_vecs_t nmn4_vecs; extern ff_vecs_t magpdb_vecs; extern ff_vecs_t compegps_vecs; extern ff_vecs_t yahoo_vecs; +extern ff_vecs_t unicsv_vecs; static vecs_t vec_list[] = { @@ -489,6 +490,12 @@ vecs_t vec_list[] = { "Yahoo Geocode API data", NULL }, + { + &unicsv_vecs, + "unicsv", + "Universal csv with field structure in first line", + NULL + }, { NULL, NULL, diff --git a/gpsbabel/yahoo.c b/gpsbabel/yahoo.c index 60a365a6a..015f2572c 100644 --- a/gpsbabel/yahoo.c +++ b/gpsbabel/yahoo.c @@ -22,7 +22,6 @@ #include "defs.h" #include "xmlgeneric.h" -static FILE *ifd; static waypoint *wpt_tmp; static char *as; -- 2.30.2